Integrated Simulation and Hardware - test Environment for Microcontroller Development
نویسندگان
چکیده
This paper demonstrates the strength of National Instruments hardware and software technology in a situation where it is important to build a heterogeneous environment with the need of simulation, prototype test, field measurements and production test. Since the same environment is used in different places in the R&D process, it speeds up the development and cuts back the costs. The ability to develop and tune control algorithms without being connected to the real controlled system or not using the prototype controller witch might not even exist at an early phase, opens a great opportunity for concurrent engineering especially in a Virtual Company. The fact that the simulation of the controlled system can be developed both in LabVIEW and Matlab environment helps to reduce the time of the specification for the customers since it is possible to use their model of the system that is required to be controlled. Introduction As a small private company mostly developing prototypes, individual process control, and measurement applications it is crucial for us to utilize the latest technology in the development process itself as well as in the applications. Our latest project is to develop customizable low cost microcontrollers for different applications. It is essential to develop general solutions to make it easy to adjust for more applications easily. Generally to design a process control application, it is necessary to have a good knowledge about the process. It does not only require expertise in several fields, but also requires the process or the controlled system for testing and parameter verification. That’s where simulation comes in. Since we are already developing integrated simulation and test systems for Electronic Control Units (ECU) in the automotive industry using LabVIEW, and National Instruments DAQ, the questions raised were trivial. Is it possible to simulate the complete process including controller, and controlled system in a PC environment? Is it possible to use the same environment further more to stimulate the microcontroller prototype in real time to verify the production code in it? This paper not only answers these questions, but shows the strengths of LabVIEW as a software integration environment in the development process. Simulation There are many ways to implement simulations in LabVIEW environment. Using native functions of G language, using simulation VIs or complete libraries, calling Matlab and Simulink from Matlab Script node and so on. However it is always an advantage to reuse already existing code and use it as an independent component as far as it is possible. That is why we choose to develop a VI library to be able to connect to standalone executable simulation models created with Matlab/Simulink and Real-Time WorkShop supplied by MathWorks. Since Matlab/Simulink is one of the leading products on the market for simulation and it is widely used in the industry it seemed obvious to have the possibility to use the knowledge already fed into those models and develop a controller around it, as if it would be the real system. This way, simulation and controller development could be separated and managed in different threads. While it seems to be easy to think about the controlled system as a black box separated from the controller there are many problems to solve: o Getting information about the model o Passing input values and receiving outputs o Synchronizing the controller and the model There are two ways to get information about the model structure, tunable parameters, and outputs. The first way is to use Matlab/Simulink built in commands to get these information via ActiveX server functionality of Matlab. We have developed a VI set to control Simulink models from LabVIEW witch still has an advantage on Matlab Script node. This advantage is the possibility to receive the complete “execute string” after the Matlab command. The native Matlab Script node can only handle numeric types. The “execute string” is important because most of the information you can get about the model hierarchy is string or cell type. This output then needs further phrasing and evaluation to extract the information and convert it to LabVIEW format. The following figure shows the main VI of the set we have developed to control Simulink from G. Figure 1 Block Diagram of ExecuteMatlab.vi However, the method shown above requires the complete model source. This may be difficult to share between organization considering classification and other parallel development issues. The other disadvantage of using Simulink directly is the performance. Especially with large sophisticated models it is running very slowly. This fact makes it impossible to use it for parameter tuning or controller optimization. Therefore we have developed a VI set to process the header file that Real-Time WorkShop creates when the standalone executable is created. Another text file is created with a simple script file that contains the initial values of tunable parameters. It was originally developed in another project and LabVIEW gave a great help reusing the VIs. Figure 2 User interface for selecting outputs and tunable parameters This is an easy to use tool to visualize the model hierarchy. It is easy to locate output signals, and select tunable parameters. Once we have the variable names both on input and output side we can use that list with the VI set for exchanging parameter values with the model. TCP/IP A Stand-alone executable is generated by Real-Time WorkShop contains an external communication interface. It implements parameter download to the target, upload log data from the model and mechanism for triggering. Figure 3 Matlab_Ext_Comm palette The VI set shown above implements the connection on the LabVIEW side. It is based on a DLL, which contains the basic functionality, and the VIs are converting G data to the DLL and back. Figure 4 A simple example of connecting to a Simulink Model Simulation of the microcontroller The next figure shows the main software loop of the controller simulation. Figure 5 Main Software loop of the controller simulation This plug-in architecture VI simulates the Turn-round Job System, implements a Watchdog and takes care of the synchronization. The plug-in Jobs are manipulating the global registers. A parallel loop is running representing the hardware of the microcontroller. This layer directs weather the register values are coming from converted real electrical signals through the DAQ system or from the simulation model. The same layer connects the registers to the real controller or virtual pin handled by the simulation. Figure 6 Prototype controller Synchronization Since it was the original design plan to create an environment where all the components handle their own execution time and the slowest controls the final simulation time, it couldn’t be implemented as a simple master-slave communication. Therefore as it is shown above, there are two parallel notification mechanism. The first one notifies the controller that the model is ready. The input signals are available on the controller virtual pins. The second one tells the simulation loop that the controller is ready and all the output pins are available. When simulation is connected to the real DAQ system then the main loop in the hardware abstraction layer tells the simulation that all the measured inputs are available. When the simulation step is ready, the notifier tells to other Vis that the virtual pins are available and it is time to convert them to real electrical signals. While there are no speed requirements when all the components are simulated and it is only the user efficiency that is concerned, it is important to ensure that the simulation is running in Real-Time when it is connected to the real hardware. Hardware connection diagram PC compatible computer National Instruments DAQ card(s) DILCC RS-232C or RS-485 connection for in-system programming, configuration, setting the command variables Output signals Input signals Simulated input signals: Thermocouples RTDs 0..10 V 0..20 mA Discrete 24 VDC Discrete TTL/CMOS Output signals: PWMs 0..10 V ± 5 V 0..20 mA 4..20 mA Discrete 24 VDC Discrete TTL/CMOS Command variables Controller parameters Figure 7 General hardware arrangement for the integrated environment The general concept has been used in different ways. Figure 8 Control software verification Figure 9 Verification and test of the production controller code It is used for parameter verification of the controlled system and parameter tuning of the controller. The same arrangement is used for production test of Power Unit and the controller. Measured data and parameters are stored in an ACCESS database. Conclusions With the help of the method and technology is described in this paper, we were able to create a development and test environment. The help of this flexible environment we have developed an industrial application, where we are able to control the temperature somewhere in a chamber, or in a solid part with only measuring 2 or more easily measurable temperature. The development including the environment development took less time than it would have taken with traditional methods. Pentium class PC Computer National Instruments AT-MIO-16E-10 Naturen Ltd. prototype card Controller Unit RS-232C line (controller parameters, configuration)
منابع مشابه
IoT Based Load Management of a Micro-Grid Using Arduino and HMAS
This paper aims to establish an Arduino and IoT-based Hierarchical Multi-Agent System (HMAS) for management of loads’ side with incentive approach in a micro-grid. In this study, the performance of the proposed algorithm in a micro-grid has been verified. The micro-grid contains a battery energy storage system (BESS) and different types of loads known as residential consumer (RC), commercial co...
متن کاملThe Integrated Development System for Vehicle Control based on Seamless Connection between Hard and Software Implementation
This paper, establishes a complete vehicle model in MATLAB/Simulink development environment, constructs a vehicle control application using Stateflow, Generates C source code for a microcontroller with Real Time Workshop, builds object code for target CPU, develops an efficient seamless development system used in real-time hardware in the loop system, and validates the system practical performa...
متن کاملHardware in Loop of a Generalized Predictive Controller for a Micro Grid DC System of Renewable Energy Sources
In this paper, a hardware in the loop simulation (HIL) is presented. This application is purposed as the first step before a real implementation of a Generalized Predictive Control (GPC) on a micro-grid system located at the Military University Campus in Cajica, Colombia. The designed GPC, looks for keep the battery bank State of Charge (SOC) over the 70% and under the 90%, what ensures the bes...
متن کاملDevelopment of hardware system using temperature and vibration maintenance models integration concepts for conventional machines monitoring: a case study
This article describes the integration of temperature and vibration models for maintenance monitoring of conventional machinery parts in which their optimal and best functionalities are affected by abnormal changes in temperature and vibration values thereby resulting in machine failures, machines breakdown, poor quality of products, inability to meeting customers’ demand, poor inventory contro...
متن کاملAn Operating System in Java for the Lego Mindstorms RCX Microcontroller
The Lego Mindstorms is a Lego bricks based robotics toy series produced by the Lego Group, based on the ideas developed at the Massachusetts Institute of Technology in the Programmable Brick project. The heart of a Lego robot, the RCX microcontroller, hosts a Hitachi H8 microcontroller with 28 kilobytes of memory available for downloadable firmware and applications. In addition to the GUI based...
متن کاملDesigning a Modular-approach of Multi-microcontroller Based Educational Training System with Ide
The advancement of microcontroller technology demands the need of everyone have grasp of this technology. In fact this technology is a compulsory course in any electrical or electronic field of engineering. This paper aims to describe development of a flexible microcontroller training system based on 8-bit microcontroller in Microchip, Motorola and Intel family. According to the latest survey, ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2000